import Head from 'next/head'
import style from './list.module.css'
import { join } from 'path'
import { readFile } from 'fs'
import { promisify } from 'util'

const read = promisify(readFile)

export default function List ({data}) {
  return <>
    <Head>
      <title>list page</title>
    </Head>
    <div className={style.demo}>list</div>
    <div>{data}</div>
  </>
}

export async function getStaticProps () {
  const data = await read(join(process.cwd(), 'pages', '_app.js'), 'utf-8')
  // console.log(data)
  return {
    props: {
      data
    }
  }
}
export async function getServerSideProps (context) {
  const data = await read(join(process.cwd(), 'pages', '_app.js'), 'utf-8')
  console.log('HELLO')
  return {
    props: {
      data
    }
  }
}